package net.huashitong.supervision.task.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.supervision.task.dao.SpecialTaskDao;
import net.huashitong.supervision.task.entity.SpecialTask;
import net.huashitong.supervision.task.filter.SpecialTaskFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author ling
 * @date: 2020/2/25
 * @time: 10:12
 * @version: 1.0
 * @Description:
 */
@Service
public class SpecialTaskService extends StringPKService<SpecialTask> {
    @Autowired
    private SpecialTaskDao dao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<SpecialTask, String> getDao() {
        return dao;
    }

    public void save(SpecialTask obj,String userId) {
        obj.setCreateUser(userId);
        super.save(obj);
    }

    @Override
    protected void beforeSave(SpecialTask obj) {
        obj.setSysId(tableService.updateMaxSysId("t_special_task", null));
    }

    public List<SpecialTask> queryFilter(SpecialTaskFilter filter) {
        return dao.queryFilter(filter);
    }
}
